package com.ebao.po.blog;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.ebao.constants.UserType;

/**
 * @desc 博客评论
 * @author snow
 * @date 2012-7-10
 */
@Entity
@Table(name = "T_Blog_Comment")
public class TBlogComment implements Serializable {

	private static final long serialVersionUID = -1704985071545823982L;
	
	private Long id;
	private TBlog blog;				// 评论的博文1
	private TShareBlog shareBlog;	// 评论分享的博文2,两者只有一个不为空是两种不同的评论
	private UserType reviewerType;	// 评论者类型user/doctor
	private String reviewerId;		// 评论者Id
	private String content;			// 评论内容
	private String commentDate;		// 评论日期
	private boolean isRoot;			// 是否最顶层评论
	private TBlogComment parent;	// 上层评论,递归

	@Id
	@GeneratedValue
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(optional = false, targetEntity = TBlog.class)
	@JoinColumn(name = "blog_id")
	public TBlog getBlog() {
		return blog;
	}

	public void setBlog(TBlog blog) {
		this.blog = blog;
	}

	@ManyToOne(optional = false, targetEntity = TShareBlog.class)
	@JoinColumn(name = "shareBlog_id")
	public TShareBlog getShareBlog() {
		return shareBlog;
	}

	public void setShareBlog(TShareBlog shareBlog) {
		this.shareBlog = shareBlog;
	}

	public UserType getReviewerType() {
		return reviewerType;
	}

	public void setReviewerType(UserType reviewerType) {
		this.reviewerType = reviewerType;
	}

	public String getReviewerId() {
		return reviewerId;
	}

	public void setReviewerId(String reviewerId) {
		this.reviewerId = reviewerId;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Column(length = 19)
	public String getCommentDate() {
		return commentDate;
	}

	public void setCommentDate(String commentDate) {
		this.commentDate = commentDate;
	}

	public boolean isRoot() {
		return isRoot;
	}

	public void setRoot(boolean isRoot) {
		this.isRoot = isRoot;
	}

	@OneToOne(targetEntity = TBlogComment.class)
	@JoinColumn(name = "parent_id")
	public TBlogComment getParent() {
		return parent;
	}

	public void setParent(TBlogComment parent) {
		this.parent = parent;
	}

}
